<?php 
$sql =	"SELECT
			  c.page_id,
			  d.title,
			  d.description,
			  d.meta_key,
			  d.meta_description	
		  FROM
			  pages AS c,
			  page_description AS d
		  WHERE
		  
			  c.page_id = d.page_id
			  AND
			  d.lang_id = '".$_SESSION['lang_id']."'
			  AND
			  c.sef_url = '".$sef_url."' 
			  AND c.published
		  ";
$result = query($sql);
$row = mysql_fetch_object($result);


head(sth($row->title),sth($row->meta_description));

?>


		
        
        
        <div id="content">
			
			<div class="left wide">
				
				<h1><?=stripslashes($row->title)?></h1><br>
				
                <?=stripslashes($row->description)?>
				
                <?php
            	require '../include/frontpaging.inc.php';
				$sql = "SELECT
				c.sef_url,
				c.new_id,
				c.creation_time,
				
				d.title,
				d.description
				
			FROM
				news AS c,
				news_description AS d
			WHERE
				c.new_id = d.new_id
				AND
				d.lang_id = '".$_SESSION['lang_id']."'
				AND c.published
				
			  ";
			  if (!isset($_GET['sort'])) $_GET['sort'] = 1;
			  if (!isset($_GET['sortBy'])) $_GET['sortBy'] = 2;
	
				$paging = new Paging($sql, $_GET['sortBy'], $_GET['sort'], array(2=>"Подредба"), 15);
				$result = $paging->query();
			
			   while ($row = mysql_fetch_object($result)) {
			?>
            
				<div class="new">
					<div class="title"><a href="<?=HTML_BASE.$_SESSION['lang']?>/news/<?=$row->sef_url?>"><?=$row->title?></a></div>
					<div class="date"><?=date('d.m.Y', strtotime($row->creation_time))?></div>
					<div class="content">
						<p><?=strip_tags(text_format($row->description, 200))?>...</p>
					</div>
					<a class="readmore" href="<?=HTML_BASE.$_SESSION['lang']?>/news/<?=$row->sef_url?>"><?=__Read_more?></a>
				</div>
				<?php }?>
				
				<div class="pagingwrap">
                    <div class="paging">
                    	<?=$paging->display()?>
                    </div>
                </div>
				
            </div>    
			
			<div class="right narrow">
				
				
				
			</div>
			
		</div>
   
	
<?php

foot();
?>